require 'gosu'
require 'utils'
require 'zindex'

class Intro
  def initialize(window,player)
    @window
    @player=player
    @title_font = Gosu::Font.new(window, "croobie", 130) #other nice fonts found in open office: jokewood, century gothic,chick, constantia 
    @text_font = Gosu::Font.new(window, "Arial Black", 100) 
    @factor_offset = 0
    @cur_intro_image = @player.standing
    @background = Image.new(window, "#{cur_dir}/graphics/euruko_logo.png", true)
  end
  
  def update
    @cur_intro_image = case (milliseconds / 200 % 4 ) 
        when 0          
          @player.walk1
        when 1,3          
          @player.standing
        when 2          
          @player.walk2        
      end
      @factor_offset = (Math.sin(milliseconds / 1000.0) /2 )
  end
  
  def draw   
    factor = 2.0 + @factor_offset
    @cur_intro_image.draw(20,330,Zindex::INTRO,factor,factor) 
    factor = 2.0 - @factor_offset
    @cur_intro_image.draw(620,330,Zindex::INTRO,factor*-1,factor)
    
    @background.draw(0,0,0)
    
    factor=@title_font.get_max_factor('EuRuKUEST',1.0,620,true)    
    @title_font.shadow_text("EuRuKUEST", 20, 0, Zindex::TEXT, factor, factor, 0xFFB90000)
    factor=@text_font.get_max_factor('INSERT',1.0, 300,true )
    @text_font.draw("INSERT", 180, 310, Zindex::TEXT, factor, factor, 0xFF568AC8)
    @text_font.draw("COIN", 200, 390, Zindex::TEXT, factor, factor, 0xFF93C3ED)
  end
  
  
end
